#pragma once
#include <iostream>
#include <fstream>
#include "Defines.h"

enum ValueType { AT_UNKNOWN = 0, AT_INT, AT_FLOAT, AT_STRING };

class Value
{
public:
	Value();
	Value(int Source);
	Value(float Source);
	Value(const char *Source);
	Value(const char *Name, int Source);
	Value(const char *Name, float Source);
	Value(const char *Name, const char *Source);
	//Value(Value &Source);
	Value(const Value &Source);
	~Value();
	char name[NAMELEN];
	ValueType GetType() const;
	void SetType(ValueType newType);
	Value & operator = (const Value &Source);
	Value operator + (const Value &Source) const;
	Value operator - (const Value &Source) const;
	Value operator * (const Value &Source) const;
	Value operator / (const Value &Source) const;
	Value & operator += (const Value &Source);
	Value & operator -= (const Value &Source);
	Value & operator *= (const Value &Source);
	Value & operator /= (const Value &Source);
	bool operator == (const Value &Source) const;
	bool operator != (const Value &Source) const;
	bool operator < (const Value &Source) const;
	bool operator > (const Value &Source) const;
	bool operator <= (const Value &Source) const;
	bool operator >= (const Value &Source) const;
	int ToInt() const;
	float ToFloat() const;
	const char *ToCharPtr() const;
	Value GetTypeString() const;
	Value ToSendableString() const;
	void SetFromSendable(char *Incoming);
protected:
	void Copy(const Value &Source);
	ValueType valueType;
	void *Data;
	friend std::ostream & operator << (std::ostream &cout, Value &Source);
	friend std::ofstream & operator << (std::ofstream &cout, Value &Source);
};

